package org.mlz.game.model

/**
 *<p>
 *显示的视图 定义显示的规范
 *</p>
 * CreateBy  Malingzhao
 * @date  2020/9/18
 */
interface View {


    //可以定义属性让实现类去实现
    val x: Int
    val y: Int
    val width: Int
    val height: Int


    //显示
    fun draw()


    fun checkCollision(
        x1: Int, y1: Int, w1: Int, h1: Int,
        x2: Int, y2: Int, w2: Int, h2: Int
    ): Boolean {

        return when {
            y2 + h2 <= y1 ->
                false
            y1 + h1 <= y2 ->
                false
            x2 + w2 <= x1 ->
                false
            else -> x1 + w1 > x2
        }
    }


}
